#ifndef prs_FrmScrollBar_H
#define prs_FrmScrollBar_H

#include "prs_FrmFunc.h"
#include "prs_FrmRules.h"
#include "prs_FrmGeom.h"
#include "prs_FrmControl.h"
#include "prs_FrmScrollBarStyle.h"
#include "frm_control_TScrollBar.h"

namespace prs {

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmHScrollBar : public TNodeFrmControl
{
  DECLARE_ClientNode()
  //
  typedef TNodeFrmHScrollBarStyle      TStyle;
  typedef frm::control::TScrollBarHorz TControl;
  //
  TAttrNodeType<nodeType_HSplitter> NodeType;
  TAttrPointerNoCopy<attrName_Control,frm::control::TScrollBarHorz*> Control;
  //
  TNodeFrmHScrollBar() : NodeType(this),Control(this) {}
 ~TNodeFrmHScrollBar() { delete Control.GetValue();}
};
                   
///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmHScrollBar : public snt::TRule
{
  TRuleFrmHScrollBar(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmChildrenBase &RChildren,
    TRuleSetNodeIdOptionally &RSetNodeIdOptionally,
    TRuleFrmGeom &RFrmGeom,
    TRuleSetStyle &RStyle
  );

private:  
  TNodeFrmHScrollBar *GetNode() { return dynamic_cast<TNodeFrmHScrollBar*>(vParentNode.Pointer());}
  //
  void FSetGeometry(snt::TParams &Params) { rGeometry.SetGeom( &GetNode()->Geometry.Value );}
  //
  svl::TVariant &vParentNode;
  TRuleFrmGeom &rGeometry;
  snt::TRule  RAttr,RAttr1;
  snt::TAlter AAttr1;
  svl_Except;
};

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmVScrollBar : public TNodeFrmControl
{
  DECLARE_ClientNode()
  //
  typedef TNodeFrmVScrollBarStyle      TStyle;
  typedef frm::control::TScrollBarVert TControl;
  //
  TAttrNodeType<nodeType_VSplitter> NodeType;
  TAttrPointerNoCopy<attrName_Control,frm::control::TScrollBarVert*> Control;
  //
  TNodeFrmVScrollBar() : NodeType(this),Control(this) {}
 ~TNodeFrmVScrollBar() { delete Control.GetValue();}
};
                   
///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmVScrollBar : public snt::TRule
{
  TRuleFrmVScrollBar(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmChildrenBase &RChildren,
    TRuleSetNodeIdOptionally &RSetNodeIdOptionally,
    TRuleFrmGeom &RFrmGeom,
    TRuleSetStyle &RStyle
  );

private:  
  TNodeFrmVScrollBar *GetNode() { return dynamic_cast<TNodeFrmVScrollBar*>(vParentNode.Pointer());}
  //
  void FSetGeometry(snt::TParams &Params) { rGeometry.SetGeom( &GetNode()->Geometry.Value );}
  //
  svl::TVariant &vParentNode;
  TRuleFrmGeom &rGeometry;
  snt::TRule  RAttr,RAttr1;
  snt::TAlter AAttr1;
  svl_Except;
};

///////////////////////////////////////////////////////////////////////////////
}

#endif
